﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Page/Site.Master" AutoEventWireup="true" CodeBehind="asset-repair-line.aspx.cs" EnableEventValidation="false" Inherits="Presentation.Page.asset_repair_line" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <!---Check-all----->
    <script type="text/javascript">
        function checkAll(checkId) {
            $('.bordered tbody input').each(function () {
                if ($('input#chkAll').is(":checked")) {
                    $(this).attr({ 'checked': 'checked' });
                    $(this).parent().parent().css({ 'background': 'rgb(208, 233, 198)' });
                } else {
                    $(this).attr({ 'checked': false });
                    $(this).parent().parent().css({ 'background': '#ffffff' });
                }
            })
        }
    </script>
    <!-------End------->

    <!------Popup------>
    <script type="text/javascript">
        $(document).ready(function () {
            //setup new person dialog
            $('#assetrepairline').dialog({
                autoOpen: false,
                draggable: true,
                height: "auto",
                width: "auto",
                position: ['center', 50],
                resizable: false,
                create: function (event) { $(event.target).parent().css('position', 'fixed'); },
                open: function (type, data) {
                    $(this).parent().appendTo("form");
                }
            });
        });
    </script>

    <script type="text/javascript">
        $(document).ready(function () {
            //setup new person dialog
            $('#duyetassetrepairline').dialog({
                autoOpen: false,
                draggable: true,
                height: "auto",
                width: "auto",
                position: ['center', 50],
                resizable: false,
                create: function (event) { $(event.target).parent().css('position', 'fixed'); },
                open: function (type, data) {
                    $(this).parent().appendTo("form");
                }
            });
        });
    </script>

    <script type="text/javascript">
        $(document).ready(function () {
            //setup new person dialog
            $('#exporttoexcel').dialog({
                autoOpen: false,
                draggable: true,
                height: "auto",
                width: "auto",
                position: ['center', 50],
                resizable: false,
                create: function (event) { $(event.target).parent().css('position', 'fixed'); },
                open: function (type, data) {
                    $(this).parent().appendTo("form");
                }
            });
        });
    </script>

    <script type="text/javascript">
        $(document).ready(function () {
            //setup new person dialog
            $('#thongbao').dialog({
                autoOpen: false,
                draggable: true,
                height: "auto",
                width: "372px",
                position: ['center', 50],
                resizable: false,

                create: function (event) { $(event.target).parent().css('position', 'fixed'); },
                open: function (type, data) {
                    $(this).parent().appendTo("form");
                }
            });
        });
    </script>

    <script type="text/javascript">
        $(document).ready(function () {
            //setup new person dialog
            $('#thongbaoxoa').dialog({
                autoOpen: false,
                draggable: true,
                height: "auto",
                width: "372px",
                position: ['center', 50],
                resizable: false,

                create: function (event) { $(event.target).parent().css('position', 'fixed'); },
                open: function (type, data) {
                    $(this).parent().appendTo("form");
                }
            });
        });
    </script>
    <!-------End------->

    <!---AutoComplete-->
    <script type="text/javascript">
        function pageLoad(sender, args) {
            $(document).ready((function () {
                var availableTags1 = [ <%= SuggestionList %>];

                $("#<%= txtSearch.ClientID %>").autocomplete({
                    source: availableTags1
                });
            }));

            $(function () {
                $(".textboxngaynhap").datepicker({
                    showOn: "button",
                    buttonImage: "../images/calendar.gif",
                    dateFormat: 'dd/mm/yy',
                    changeMonth: true,
                    changeYear: true,
                    buttonImageOnly: true
                }).val();
            });


            $(function () {
                $(".textboxfillter").datepicker({
                    showOn: "button",
                    buttonImage: "../images/calendar.gif",
                    dateFormat: 'dd/mm/yy',
                    changeMonth: true,
                    changeYear: true,
                    buttonImageOnly: true
                }).val();
            });

            $(function ($) {
                $(".textboxngaynhap").mask("99/99/9999"); //Kiem tra ngay nhap
                $(".textboxfillter").mask("99/99/9999"); //Kiem tra ngay nhap
                $("#phone").mask("(999) 999-9999");//Kiem tra so dien thoai
                $("#tin").mask("99-9999999");
                $("#ssn").mask("999-99-9999");
            });

            //Check Row Hender Color
            $(document).ready(function () {
                $('.adminlist1 tr').click(function (event) {
                    if (event.target.type !== 'checkbox') {
                        $(':checkbox', this).trigger('click');
                    }
                });

                $("input[type='checkbox']").change(function (e) {
                    if ($(this).is(":checked")) {
                        $(this).closest('tr').css("background", "Wheat");
                    } else {
                        $(this).closest('tr').css("background", "");
                    }
                });
            });
        }
    </script>
    <!-------End------->
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <asp:UpdatePanel ID="upDateToolBar" runat="server">
        <ContentTemplate>
            <div id="toolbar-1" class="yui3-toolbar">
                <div class="div-search-texbox">
                    <asp:TextBox ID="txtSearch" placeholder="Nhập vào từ khoá tìm kiếm..." CssClass="textbox_child_Search" runat="server"></asp:TextBox>
                </div>

                <div class="div-search">
                    <asp:Button ID="cmdSerach" ToolTip="Tìm kiếm" runat="server" CssClass="btn-add-search" Text="" OnClick="cmdSerach_Click" />
                    <asp:Button ID="cmdRefesh" ToolTip="Làm tươi" runat="server" CssClass="btn-add-refesh" Text="" OnClick="cmdRefesh_Click" />


                    <asp:Button ID="cmdDuyet" ToolTip="Duyệt" runat="server" CssClass="btn-add-review" Text="" OnClick="cmdDuyet_Click" />
                    <asp:Button ID="cmdExport" Visible="false" runat="server" CssClass="btn-add-excel" Text="" OnClick="cmdExport_Click" />
                    <input type="button" title="Xuất ra tập tin Excel" onclick="tableToExcel('testTable', 'W3C Example Table')" class="btn-add-excel" />
                </div>
                <div class="clr"></div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>

    <asp:UpdatePanel ID="upDatePanelAll" runat="server">
        <ContentTemplate>
            <%=StrAlert%>
            <!-----------Hiễn-Thị-Dữ-Liệu------------>
            <asp:ListView ID="ListViewAll" runat="server" DataKeyNames="STT" OnSorting="ListViewAll_Sorting" OnPagePropertiesChanging="ListViewAll_PagePropertiesChanging" OnItemCommand="ListViewAll_ItemCommand" OnItemDataBound="ListViewAll_ItemDataBound">
                <EmptyDataTemplate>
                    <p>No Records Found..</p>
                </EmptyDataTemplate>
                <LayoutTemplate>
                    <table class="bordered">
                        <thead>
                            <tr>
                                <th style="width: 5%">
                                    <asp:LinkButton ID="LinkButton1" CommandArgument="STT" CommandName="Sort" Text="STT" runat="server" />
                                </th>
                                <th style="width: 5%">
                                    <input type="checkbox" onclick="checkAll('chkList');" id="chkAll">
                                </th>
                                <th style="width: 5%">
                                    <asp:LinkButton ID="lbMa" CommandArgument="Mã Phụ Tùng" CommandName="Sort" Text="Mã Phụ Tùng" runat="server" />
                                </th>
                                <th style="width: 10%">
                                    <asp:LinkButton ID="lbTen" CommandArgument="Tên Phụ Tùng" CommandName="Sort" Text="Tên Phụ Tùng" runat="server" />
                                </th>
                                <th style="width: 10%">
                                    <asp:LinkButton ID="LinkButton7" CommandArgument="Số Lượng" CommandName="Sort" Text="Số Lượng" runat="server" />
                                </th>
                                <th style="width: 10%">
                                    <asp:LinkButton ID="LinkButton8" CommandArgument="Tài Sản" CommandName="Sort" Text="Tài Sản" runat="server" />
                                </th>
                                <th style="width: 10%">
                                    <asp:LinkButton ID="LinkButton9" CommandArgument="Giá Trị Hiện Tại" CommandName="Sort" Text="Giá Trị Hiện Tại" runat="server" />

                                </th>
                                <th style="width: 10%">
                                    <asp:LinkButton ID="LinkButton10" CommandArgument="Hãng Sản Xuất" CommandName="Sort" Text="Hãng Sản Xuất" runat="server" />

                                </th>
                                <th style="width: 10%">
                                    <asp:LinkButton ID="LinkButton11" CommandArgument="Ghi Chú" CommandName="Sort" Text="Ghi Chú" runat="server" />

                                </th>
                                <th style="width: 10%">
                                    <asp:LinkButton ID="LinkButton12" CommandArgument="Hạn Bảo Hành" CommandName="Sort" Text="Hạn Bảo Hành" runat="server" />

                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr id="itemPlaceholder" runat="server">
                            </tr>
                        </tbody>
                    </table>
                </LayoutTemplate>
                <ItemTemplate>
                    <tr runat="server">
                        <td style="text-align: center">
                            <asp:Label ID="lb_lst_ID" runat="server" Text='<%# Eval("STT") %>'></asp:Label>
                        </td>

                        <td style="text-align: center">
                            <asp:CheckBox ID="chkList" onclick='highlight(this)' ClientIDMode="Static" runat="server" />
                        </td>
                        <td style="text-align: center">
                            <asp:LinkButton ID="linkListName_0" CommandName="Accept_0" runat="server"><%# Eval("Mã Phụ Tùng")%></asp:LinkButton>
                            <input type="hidden" id="hiddenId" value='<%# Eval("STT") %>' runat="server" name="hiddenId" />
                        </td>
                        <td style="text-align: center">
                            <asp:LinkButton ID="linkListName_1" CommandName="Accept_1" runat="server"><%# Eval("Tên Phụ Tùng")%></asp:LinkButton>
                        </td>
                        <td style="text-align: center">
                            <asp:LinkButton ID="linkListName_2" CommandName="Accept_2" runat="server"><%# Eval("Số Lượng")%></asp:LinkButton>
                        </td>
                        <td style="text-align: center">
                            <asp:LinkButton ID="linkListName_3" CommandName="Accept_3" runat="server"><%# Eval("Tài Sản")%></asp:LinkButton>
                        </td>
                        <td style="text-align: center">
                            <asp:LinkButton ID="linkListName_4" CommandName="Accept_4" runat="server"><%# Eval("Giá Trị Hiện Tại")%></asp:LinkButton>
                        </td>
                        <td style="text-align: center">
                            <asp:LinkButton ID="linkListName_5" CommandName="Accept_5" runat="server"><%# Eval("Hãng Sản Xuất")%></asp:LinkButton>
                        </td>
                        <td style="text-align: center">
                            <asp:LinkButton ID="linkListName_6" CommandName="Accept_6" runat="server"><%# Eval("Ghi Chú")%></asp:LinkButton>
                        </td>
                        <td style="text-align: center">
                            <asp:LinkButton ID="linkListName_7" CommandName="Accept_7" runat="server"><%# Eval("Hạn Bảo Hành")%></asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:ListView>
            <!--------------Kêt-thúc----------------->
            <!-------------Phân-trang---------------->
            <table class="bordered">
                <thead>
                    <tr>
                        <th class="pager">
                            <asp:DataPager ID="DataPagerListAll" runat="server" PagedControlID="ListViewAll">
                                <Fields>
                                    <asp:NextPreviousPagerField FirstPageText="&lt;&lt;" PreviousPageText="&lt;"
                                        ShowFirstPageButton="True" ShowNextPageButton="False" />
                                    <asp:NumericPagerField />
                                    <asp:NextPreviousPagerField LastPageText="&gt;&gt;" NextPageText="&gt;"
                                        ShowLastPageButton="True" ShowPreviousPageButton="False" />
                                </Fields>
                            </asp:DataPager>
                        </th>
                    </tr>
                </thead>
            </table>
            <!--------------Kêt-thúc----------------->
        </ContentTemplate>
    </asp:UpdatePanel>

    <!-------------Exprot-Excel-------------->
    <asp:UpdatePanel ID="upDatePanelExport" runat="server">
        <ContentTemplate>
            <asp:ListView ID="ListViewExport" runat="server" DataKeyNames="STT" OnItemDataBound="ListViewExport_ItemDataBound">
                <EmptyDataTemplate>
                    <p>No Records Found..</p>
                </EmptyDataTemplate>
                <LayoutTemplate>
                    <table class="bordered" id="testTable" style="display: none">
                        <thead>
                            <tr>
                                <th style="width: 5%">STT</th>
                                <th style="width: 10%">Mã Phụ Tùng</th>
                                <th style="width: 10%">Tên Phụ Tùng</th>
                                <th style="width: 10%">Số Lượng</th>
                                <th style="width: 10%">Tài sản</th>
                                <th style="width: 10%">Giá trị hiện tại</th>
                                <th style="width: 10%">Hãng Sản Xuất</th>
                                <th style="width: 10%">Ghi Chú</th>
                                <th style="width: 10%">Hạng Bảo hành</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr id="itemPlaceholder" runat="server">
                            </tr>
                        </tbody>
                    </table>
                </LayoutTemplate>
                <ItemTemplate>
                    <tr runat="server">
                        <td style="text-align:center">
                            <asp:Label ID="lbSTT" runat="server" Text='<%# Eval("STT") %>'></asp:Label>
                        </td>

                        <td style="text-align:center">
                            <asp:Label ID="Label2" runat="server" Text='<%# Eval("Mã Phụ Tùng") %>'></asp:Label>
                        </td>

                        <td style="text-align:left">
                            <asp:Label ID="lbLoaiTaiLieu" runat="server" Text='<%# Eval("Tên Phụ Tùng") %>'></asp:Label>
                        </td>

                        <td style="text-align:left">
                            <asp:Label ID="Label4" runat="server" Text='<%# Eval("Số Lượng") %>'></asp:Label>
                        </td>

                        <td style="text-align:left">
                            <asp:Label ID="Label5" runat="server" Text='<%# Eval("Tài Sản") %>'></asp:Label>
                        </td>

                        <td style="text-align:right">
                            <asp:Label ID="Label6" runat="server" Text='<%# Eval("Giá Trị Hiện Tại","{0:0,00}") %>'></asp:Label>
                        </td>

                        <td style="text-align:left">
                            <asp:Label ID="Label7" runat="server" Text='<%# Eval("Hãng Sản Xuất") %>'></asp:Label>
                        </td>

                        <td style="text-align:right">
                            <asp:Label ID="Label8" runat="server" Text='<%# Eval("Ghi Chú") %>'></asp:Label>
                        </td>

                        <td style="text-align:center">
                            <asp:Label ID="Label9" runat="server" Text='<%# Eval("Hạn Bảo Hành") %>'></asp:Label>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:ListView>
        </ContentTemplate>
    </asp:UpdatePanel>
    <!--------------Kêt-thúc----------------->

    <!-------------Edit-Dữ-Liệu-------------->
    <div id="assetrepairline" title="Xét duyệt tài sản">
        <asp:UpdatePanel ID="upNewUpdatePanel" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
            <ContentTemplate>
                <div class="toolbar-ui-all-big">
                    <asp:Button ID="imgSave" runat="server" CssClass="btn-add-review" Text="" OnClick="imgSave_Click" />
                    <asp:Button ID="imgrefesh" runat="server" CssClass="btn-add-refesh" Text="" OnClick="imgrefesh_Click" />
                </div>

                <div class="clr"></div>
                <div class="ui-main">
                    <div style="display: none">
                        <asp:Label ID="lbID" runat="server"></asp:Label>
                    </div>
                    <div class="ui-box-text-box">
                        <label class="label">
                            Mã Phụ Tùng
                        </label>
                        <asp:TextBox ID="txtMaPhuTung" CssClass="textbox" runat="server"></asp:TextBox>
                    </div>

                    <div class="ui-box-text-box">
                        <label class="label">
                            Tên Phụ Tùng
                        </label>
                        <asp:TextBox ID="txtTenPhuTung" CssClass="textbox" runat="server"></asp:TextBox>
                    </div>

                    <div class="ui-box-text-box">
                        <label class="label">
                            Số lượng
                        </label>
                        <asp:TextBox ID="txtSoLuong" CssClass="textbox" runat="server"></asp:TextBox>
                    </div>

                    <div class="ui-box-text-box">
                        <label class="label">
                            Tài Sản
                        </label>
                        <asp:TextBox ID="txtTaiSan" CssClass="textbox" runat="server"></asp:TextBox>
                    </div>

                    <div class="clr"></div>

                    <div class="ui-box-text-box">
                        <label class="label">
                            Giá Trị Hiện Tại
                        </label>
                        <asp:TextBox ID="txtGiaTriHienTai" CssClass="textbox" runat="server"></asp:TextBox>
                    </div>

                    <div class="ui-box-text-box">
                        <label class="label">
                            Hãng Sản Xuất
                        </label>
                        <asp:TextBox ID="txtHangSanXuat" CssClass="textbox" runat="server"></asp:TextBox>
                    </div>

                    <div class="ui-box-text-box">
                        <label class="label">
                            Ghi Chú
                        </label>
                        <asp:TextBox ID="txtGhiChu" CssClass="textbox" runat="server"></asp:TextBox>
                    </div>

                    <div class="ui-box-text-box">
                        <label class="label">
                            Hạn Bảo hành
                        </label>
                        <asp:TextBox ID="txtHanBaoHanh" CssClass="textbox" runat="server"></asp:TextBox>
                    </div>

                    <div class="clr"></div>
                </div>
                <div class="clr"></div>
                <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="upNewUpdatePanel">
                    <ProgressTemplate>
                        <img alt='loadding' class="loading" src="../images/loading-fb.gif" /><br />
                        <div class="loading-label-right">
                            Đang xử lý dữ liệu...
                        </div>
                    </ProgressTemplate>
                </asp:UpdateProgress>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="imgSave" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
    <!--------------Kêt-thúc----------------->

    <!-------------Thông-Bao-Xoá------------->
    <div id="thongbaoxoa" title="Thông Báo">
        <asp:UpdatePanel ID="upDatePanelThongBaoXoa" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
            <ContentTemplate>
                <div style="display: none">
                    <asp:Label ID="lbIDXoa" runat="server" Text=""></asp:Label>
                    <asp:Label ID="lbTrangThaiDuyet" runat="server" Text=""></asp:Label>
                </div>
                <p>
                    <span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
                    <asp:Label ID="lbThongBaoXoa" CssClass="error-msg" runat="server" Text=""></asp:Label>
                </p>
                <hr />
                <div class="toolbar-ui-footer">
                    <asp:Button ID="cmdAgree" CssClass="btn btn-info" Height="29px" runat="server"
                        Text="Đồng ý" OnClick="cmdAgree_Click" />

                    <asp:Button ID="cmdClose" CssClass="btn btn-info" Height="29px" runat="server"
                        Text="Bỏ qua" OnClick="cmdClose_Click" />
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <!--------------Kêt-thúc----------------->

    <!-------------Thông-Bao----------------->
    <div id="thongbao" title="Thông Báo">
        <asp:UpdatePanel ID="updatePanelThongBao" UpdateMode="Conditional" ChildrenAsTriggers="true" runat="server">
            <ContentTemplate>
                <p>
                    <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
                    <asp:Label ID="lbThongBaoLoi" CssClass="error-msg" runat="server" Text=""></asp:Label>
                </p>
                <hr />
                <div class="toolbar-ui-footer">
                    <asp:Button ID="cmdCloseThongBao" CssClass="btn btn-info" Height="29px" runat="server"
                        Text="Đóng lại" OnClick="cmdCloseThongBao_Click" />
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    <!--------------Kêt-thúc----------------->
</asp:Content>
